home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-12-12 | 6.0 KB | 128 lines | [TEXT/PJMM] |
- {AddOnIntf, © Rohan Cook, November 1991}
- {Part of the PowerLock Security Package}
- {This source code can be used in any fashion by all PowerLock users}
-
- {Provides an interface between PowerLock and code resources of type 'adOn'}
- {For information about this source, see the PowerLock package or write to:}
- { Rohan Cook }
- { PO Box 317 }
- { Mornington Vic 3931 }
- { Australia }
-
- {0.1 1/10/91 . commenced writing interface}
- {0.2 27/10/91 . implemented cbReqUsedToday}
- {0.3 7/11/91 . implemented aReqPWOK message}
- {0.4 8/11 . cbReqLogRaw written}
- {0.5 18/11 . support for aReqDlgItem introduced}
- { . addOn data format changed to include 'dlg' & 'item'}
- { . interface file includes constants for each of PowerLock's dialogs}
- {0.6 23/11 . added cbReqUserID}
- { . modified adOnRec to incl both PLs AOintf version and the actual add-ons AOintf version}
- { . aReqStartUp sets aoAOIFVers}
- { . put intf versions at start of record}
- { . PL modified to check versions}
- {0.7 12/12 . wrote cbReqIsLicenced}
- {1.00 12/12 . release version of addOn interface}
-
- unit adOnIntf;
- interface
-
- type
-
- {adOn Data Type - passed between adOn and PowerLock}
- {-> = data that is sent from PowerLock}
- {<- = result that your adOn resource can return}
- {<-> = two way data}
-
- adOnPtr = ^adOnRec;
- adOnRec = record
- plAOIFVers: integer; { -> PowerLocks AddOn Interface Version - format as per PowerLock Version}
- aoAOIFVers: integer; {<- The AddOns AddOn Interface Version - returned in aReqStartUp}
- plVersion: integer; { -> PowerLock Version: 200 = 2.0.0, 204=2.0.4 etc}
- username: str255; {<-> username, if used and entered, NUL if not}
- attempts: integer; { -> number of password attempts so far}
- userData: handle; {<-> unused data handle - user data can be stored here}
- bool: boolean; { -> miscellaneous boolean result}
- continue: boolean; {<- normally true - return false to abandon current operation}
- misc: handle; { -> handle to miscellaneous data}
- dlg: integer; { -> Resource ID of current dialog}
- item: integer; { -> item # of dialog item in question}
- err: OSErr; {<- last error code}
- request: str255; {<- data to pass thru to call back routine}
- result: str255; { -> result returned after callbacks}
- fileRef: integer; { -> ref # of resource file containing addon}
- callBackProc: procPtr; { -> pointer to callback handling procedure}
- reserved1: longint; { do NOT use any reserved fields}
- reserved2: longint;
- reserved3: longint;
- reserved4: str255;
- end;
-
- const
-
- {AddOn Requestors}
- {NOTE: requestors marked • will allow cancellation of the operation by returning 'continue:=false'}
- aReqStartUp = 1; {sent as soon as PowerLock is initialised}
- aReqTimeOut = 2; {• just before PL times out}
- aReqChangeBtn = 3; {• when Change button is pressed}
- aReqShutDownBtn = 4; {• when ShutDown button is pressed}
- aReqPrefsBtn = 5; {• when Prefs button is pressed}
- aReqOKBtn = 6; {• when OK on main dialog is pressed}
- aReqUserListBtn = 7; {• when Userlist button on Prefs dialog is pressed}
- aReqSaveUserList = 8; {• sent when userlist is about to be saved username = SuperUser name}
- aReqShutDown = 9; {• sent whenever PowerLock is about to be shutdown}
- aReqQuit = 10; {sent immediately before PowerLock quits}
- aReqPWIncorrect = 11; {sent whenever illegal password entered attempts=total # bad attempts at pw, username=username entered}
- aReqPWOK = 12; {• sent once password has been validated}
- aReqDlgItem = 13; {• sent whenever a dialog item has an event}
- aReqBootBlocks = 20; {• sent on Boot Blocks button in Prefs bool=current state (before click) of button}
- aReqVersion = 99; {sent when PowerLock 2nd About Box requested}
-
- {CallBack Requests}
- cbReqLog = 1; {log username & 'request' & time & date to the log file if log file enabled}
- cbReqLogRaw = 2; {log 'request' to log file 'as is' regardless if log file enabled - adds a return to the end of 'request'}
- cbReqMsg = 3; {display 'request' in PL message box}
- cbReqAlert = 4; {display 'request' as a PL Stop Alert Box}
- cbReqShutDown = 5; {shut down PowerLock}
- cbReqDraw = 6; {create new window, draw file 'request', wait for an event, close window}
- cbReqYesNo = 7; {prompt with 'request', return in result 'Y' or 'N'}
- cbReqUpdate = 8; {update the desktop}
- cbReqUsers = 9; {returns in 'result' the total number of user names set up}
- cbReqUser = 10; {given user ID in 'request', returns the decrypted user name in 'result' & current username in 'username'}
- cbReqUserID = 11; {given a username in 'username', return UserID in 'result'}
- cbReqUsedToday = 12; {returns true in bool if PowerLock has been used today}
- cbReqAppResFile = 13; {returns in fileRef a ref to PowerLock application}
- cbReqPrefsResFile = 14; {returns in fileRef a ref to the Prefs file}
- cbReqAddOnResFile = 15; {restores fileRef to point to the Add-On file}
- cbReqIsLicenced = 16; {returns true in bool if PowerLock is a licenced copy or false if it is unlicenced}
-
- {PowerLock Dialog IDs}
- {NOTE: the Change Password Dialog does not support the aReqDlgItem message & therefore is not listed}
- { Refer to a DeRez list or ResEdit for item numbers of each button & field }
- DLOGmain = 128; {main PowerLock dialog - single user (prompts for password only)}
- DLOGmainWithUsers = 132; {main PowerLock dialog - multiuser (prompts for username & password)}
- DLOGuserlist = 131; {editing PowerLock usernames}
- DLOGprefs = 133; {Preferences dialog}
- DLOGsuperPrefs = 134; {SuperSecurity Preferences dialog}
-
- procedure DoCBReq (req: integer; adOn: adOnPtr);
- function AOIntfVersion: integer; {return version number of AddOn Interface}
-
- implementation
-
- procedure CallBack (req: integer; adOn: adOnPtr; addr: procPtr);
- inline
- $205F, { MOVE.L (SP)+,A0 }
- $4E90; { JSR (A0) }
-
- procedure DoCBReq (req: integer; adOn: adOnPtr);
- begin
- CallBack(req, adOn, adOn^.CallBackProc);
- end;
-
- function AOIntfVersion: integer;
- begin
- AOIntfVersion := 100;
- end;
-
- end.